GETENV

Section: C Library Functions (3)
Updated: March 20, 1987
Index Return to Main Contents
 

NAME

getenv, setenv, unsetenv - manipulate environmental variables  

SYNOPSIS

char *getenv(name)
char *name;

void setenv(name, value)
char *name, *value;

void unsetenv(name)
char *name;
 

DESCRIPTION

Getenv searches the environment list (see environ(7)) for a string of the form name=value and returns a pointer to the string value if such a string is present, and 0 (NULL) if it is not.

Setenv searches the environment list as getenv does; if the string name is not found, a string of the form name=value is added to the environment. If it is found, its value is changed to value.

Unsetenv removes all occurrences of the string name from the environment. There is no library provision for completely removing the current environment. It is suggested that the following code be used to do so.

        static char     *envinit[1];
        extern char     **environ;
        environ = envinit;
 

SEE ALSO

csh(1), sh(1), execve(2), environ(7)


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 22:52:28 GMT, December 11, 2024